<template>
	<view class="user-head">

		<div class="top flex">
			<div class="flex flex1 adjust">
				<div class="col1 flex1">
					<u-avatar slot="icon" shape="square" size="150" src="https://cdn.uviewui.com/uview/album/1.jpg"
						customStyle="margin: -3px 5px -3px 0"></u-avatar>
					<iconText icon="e2" :text="user.realname"  />
					<iconText icon="" :text="'NO.'+ user.userId"  />
				</div>
				<div class="col2 flex1">
					<iconText icon="e1" :text="user.companyName"  />
					<iconText  margin="65px 10px 14px 0 "  icon="e3" :text="user.brokerTxt" style="margin-top: 63px;" />
					<iconText icon="e4" :text="user.autonymTxt" />
				</div>
			</div>
			<div class="right-icons">
				<div class="right-icon u-icon1" @click="toPage('/pages/user/pages/share')"></div>
				<div class="right-icon u-icon2" @click="toPage('/pages/user/pages/info')"></div>
				<div class="right-icon u-icon3" @click="toPage('/pages/user/pages/invate')"></div>
			</div>
		</div>


		<div class="line number">
			<div class="flex1">25</div>
			<div class="flex1">25%</div>
			<div class="flex1">25</div>
			<div class="flex1">25</div>
		</div>
		<div class="line attr">
			<div class="flex1">访客</div>
			<div class="flex1">回头率</div>
			<div class="flex1">本周新客</div>
			<div class="flex1">吸客排行</div>
		</div>
	</view>
</template>

<script>
	export default {
		name: "desc",
		data() {
			return {
				user: {
					broker:1,autonym:1,realname:'',
				},
				ukey:0,
			};
		},
		created() {
			this.load()
		}, 
		methods: {
			async load() {
				var tmp = this.$store.state.apiUserInfo
				console.log("加载的缓存数据",tmp);
				if (tmp.userId) {
					this.user = tmp;
				} else {
					var res = await this.ajax('/wx/user/getInfo')
					this.user = res.data;
					this.$store.dispatch("asyncApiUserInfo", res.data);
				}
				this.user.brokerTxt =  this.user.broker ? "执业经纪":"执业经纪未认证"
				this.user.autonymTxt =  this.user.autonym ? "实名认证":"未实名认证"
			},
		}
	}
</script>

<style lang="scss">
	.user-head {
		color: #FFF;
		font-size: 12px;

		.adjust {
			align-items: flex-start;
		}
 

		.col1 {
			padding-left: 20px;
		}

		.line {
			text-align: center;
		}

		.number {
			font-size: 16px;
			font-weight: 600;
		}

		.attr {
			color: #6A6A6E;
		}
	}
</style>
